#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;

class Solution {
public:
    vector<vector<int>> subsets(vector<int>& nums) {
        vector<vector<int>> result;
        func(nums,0,result);
        result.push_back({});
        return result;
    }
    void func(vector<int> nums,int index,vector<vector<int>>& result){
        if(nums.size()-1==index){
            result.push_back({nums[index]});
            return;
        }
        int tempValue = nums[index];
        func(nums,index+1,result);
        int size = result.size();
        for(int i = 0;i<size;++i){
            vector<int> temp;
            temp.push_back(tempValue);
            for(int t:result[i]){
                temp.push_back(t);
            }
            result.push_back(temp);
        }
        result.push_back({tempValue});
    }
};

int main(){
    Solution S;
    vector<int> T = {0};
    vector<vector<int>> result = S.subsets(T);
    return 0;
}
